<?php
class tag_widgetWidget extends Widget {

	public function render(){
        
        //instance model
        $tag_model = $this->model('tags');
        
        $tag_data = $tag_model->findAll(array('tag_name'), 'count desc');
        
        $tag_array = array();
        foreach ($tag_data as $lines) {
            $tag_array[] = '<a href="' . $this->create_url('index/tag'). '/?tag_name=' . urlencode($lines['tag_name']) . '" target="_self">' . $lines['tag_name'] . '</a>';
        }
        $tag_str = implode(', ', $tag_array);
        unset ($tag_array);
        
        //display widget
        include $this->view();
	}
}